<!DOCTYPE html>
<html>
<head>
    <title>SCUM新地堡大门计算器</title>
    <!--<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">-->
    <!--<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">-->
    
    <link href="../static/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="../static/css/all.min.css">
    <style>
        .custom-navbar { background-color: #2c3e50; }
        .footer { background-color: #f8f9fa; padding: 2rem 0; margin-top: 3rem; }
        .step-card { transition: transform 0.2s; }
        .step-card:hover { transform: translateY(-5px); }
    </style>
</head>
<body>
    <nav class="navbar navbar-expand-lg navbar-dark custom-navbar">
        <div class="container">
            <a class="navbar-brand" href="#">
                <!--<i class="fas fa-calculator me-2"></i>-->
                SCUM新地堡大门计算器
            </a>
        </div>
    </nav>

    <div class="container mt-5">
        <div class="card shadow rounded">
            <div class="card-body">
                <h2 class="mb-4 text-primary">
                    <!--<i class="fas fa-sliders me-2"></i>-->
                    参数设置
                </h2>
                <form method="POST">
                    <div class="row g-4 mb-4">
                        <div class="col-md-4">
                            <label class="form-label fw-bold">
                                <!--<i class="fas fa-play me-2"></i>-->
                                初始值input
                            </label>
                            <div class="input-group">
                                <span class="input-group-text"><i class="fas fa-hashtag"></i></span>
                                <input type="number" class="form-control" name="A" value="{{ form_data.A if form_data else '' }}" required>
                            </div>
                            <small class="text-muted">算式输入:为空填0 加法运算符号可省略+ 其余运算符号不可省略</small>
                        </div>
                        <div class="col-md-4">
                            <label class="form-label">目标值output_A</label>
                            <input type="number" class="form-control" name="B" value="{{ form_data.B if form_data else '' }}" required>
                        </div>
                        <div class="col-md-4">
                            <label class="form-label">目标值output_B</label>
                            <input type="number" class="form-control" name="C" value="{{ form_data.C if form_data else '' }}" required>
                        </div>
                    </div>

                    <h5 class="mt-5 mb-4 text-success">
                        <!--<i class="fas fa-list-ol me-2"></i>-->
                        运算步骤设置: 算式： 3 -2 /2 *9 类似
                    </h5>
                    {% for i in range(8) %}
                    <div class="row g-3 mb-3">
                        <div class="col-md-1">
                            <span class="badge bg-secondary">第{{ i+1 }}行</span>
                        </div>
                        <div class="col-md-5">
                            <input type="text" class="form-control" name="b_op_{{ i }}" value="{{ form_data.get('b_op_' ~ i, '') }}" placeholder="A列算式 ">
                        </div>
                        <div class="col-md-5">
                            <input type="text" class="form-control" name="c_op_{{ i }}" value="{{ form_data.get('c_op_' ~ i, '') }}" placeholder="B列算式 ">
                        </div>
                    </div>
                    {% endfor %}

                    <div class="d-grid gap-2 mt-4">
                        <button type="submit" class="btn btn-primary btn-lg">
                            <i class="fas fa-calculator me-2"></i>开始计算
                        </button>
                    </div>
                </form>
            </div>
        </div>

        {% if results %}
        <div class="row row-cols-1 row-cols-md-2 g-4 mt-4">
            {% for combo in results %}
            <div class="col">
                <div class="card h-100 step-card shadow-sm">
                    <div class="card-header bg-primary text-white">
                        <h5 class="mb-0">
                            <i class="fas fa-project-diagram me-2"></i>组合 {{ loop.index }}
                        </h5>
                    </div>
                    <div class="card-body">
                        <h5 class="card-title">组合 {{ loop.index }}</h5>
                        <ul class="list-group list-group-flush">
                            {% for step in combo %}
                                <li class="list-group-item">{{ step }}</li>
                            {% endfor %}
                        </ul>
                    </div>
                </div>
            </div>
            {% endfor %}
        </div>
        {% endif %}
    </div>

    <footer class="footer">
        <div class="container text-center text-muted">
            <p class="mb-0">
                <!--<i class="fas fa-code me-2"></i>-->
                Powered by Python Flask
                <span class="mx-2">|</span>
                <!--<i class="fas fa-palette me-2"></i>-->
                UI Designed with Bootstrap
                <span class="mx-2">|</span>AI & 随风
            </p>
        </div>
    </footer>
</body>
</html>